package com.itany.shop.service;

import com.itany.shop.entity.Order;
import com.itany.shop.entity.User;
import com.itany.shop.exception.RequestParameterErrorException;
import com.itany.shop.exception.UserNotExistException;
import com.itany.shop.exception.UserNotLoginException;
import com.itany.shop.vo.Cart;

import java.util.List;

/**
 * @author MissChen
 * @date 2024年04月02日 10:03
 */
public interface OrderService {
    /**
     * 结算，用于生成订单
     * 生成订单的时候生成一个订单与多个明细
     * 订单号的自动生成
     * @param cart
     * @param user
     * @return  订单号
     */
    public String createOrder(Cart cart, User user) throws UserNotLoginException;


    /**
     * 根据用户的id查询该用户的所有订单
     * @param user
     * @return
     * @throws UserNotExistException
     */
    public List<Order> findMyOrders(User user) throws UserNotExistException;

    /**
     * 根据订单主键id进行查找订单详情
     * @param id
     * @return
     */
    public Order findOrderDetail(Integer id) throws RequestParameterErrorException;
}
